<template>
  <div>
    <h3>超级好吃的{{title}}</h3>
    <p>价格: {{price}}元</p>
    <p>{{info}}</p>
    <p>{{obj}}</p>
    <button @click="sayPrice">拼刀刀</button>
  </div>
</template>

<script>
export default {
  // props数组形式(了解即可)
  // props: ['price', 'title', 'info', 'proId'],
  // props 对象形式(重点)
  props: {
    price: Number,
    title: {
      type: String,
      required: true
    },
    info: {
      type: String,
      default: '清仓甩卖'
    },
    obj: {
      type: Object,
      default: function() {
        return {
          name: "李丹",
          age: 16
        }
      }
    }
  },
  methods: {
    sayPrice() {
      // $emit(事件名, 参数1,参数2...)
      this.$emit('sayPriceFn', this.proId)
      // console.log(this.proId);
    }
  }
}
</script>

<style>

</style>